const mongoose = require('mongoose');
mongoose.set('strictQuery', false);
const connectDB = async () => {
  try {
    // await mongoose.connect('mongodb://127.0.0.1:27017/fullstack', {
    await mongoose.connect('mongodb://admin:Renser804@182.92.203.127:27017/fullstack?authSource=admin', {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      serverSelectionTimeoutMS: 30000,
      connectTimeoutMS: 30000,
    });
    console.log('MongoDB connected 3000');
  } catch (err) {
    console.error('Database connection error:', err);
    process.exit(1);
  }
};

module.exports = connectDB;